/**
 * @author        hejiyang <silentmanager@163.com>
 * @date          2024-11-24 15:00:32
 * Copyright © YourCompanyName All rights reserved
 */
import request from '@/config/axios'

export interface RankRes {
  deptName: string
  orderCount: number
  totalAmount: number
  userName: string
}
export interface GetHomeRes {
  auditOrderRank: RankRes[]
  companyRank: RankRes[]
  createOrderRank: RankRes[]
  deptRank: RankRes[]
  orderStatueStatistics: {
    auditRejectedAmount: number
    auditRejectedCount: number
    customerDeliveryAmount: number
    customerDeliveryCount: number
    // 待发货
    waitingDeliveryCount: number
    waitingDeliveryAmount: number
    deliveredAmount: number
    deliveredCount: number
    financeAuditAmount: number
    financeAuditCount: number
    returnedPaymentAmount: number
    returnedPaymentCount: number
    signedAmount: number
    signedCount: number
    temporaryDeliveryAmount: number
    temporaryDeliveryCount: number
    waitingAuditAmount: number
    waitingAuditCount: number
    // 拒签件
    rejectedCount: number
    rejectedAmount: number
    // 已退件
    returnedCount: number
    returnedAmount: number
  }
  teamRank: RankRes[]
  topStatistics: {
    approvedAmount: number
    approvedOrders: number
    totalAmount: number
    totalOrders: number
    waitingAuditAmount: number
    waitingAuditOrders: number
  }
}
// 首页
export const getHome = async (params: {
  dateRange: string[]
  userId?: number
  deptId?: string
}) => {
  return await request.get<GetHomeRes>({
    url: `/bms/statistics/v1`,
    params
  })
}
